#!/bin/sh
cd "${0%/*}" || exit                                # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions        # Tutorial run functions
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions      # Tutorial clean functions
#------------------------------------------------------------------------------

./Allrun.pre

# Settings
RASmodel="kEpsilon"    # "kOmegaSST"
stability="neutral"
Lmax="41.8"
qPlant="0.0"

echo "  # Computations for the atmopsheric stability = $stability:"
echo "    ## Lmax = $Lmax [m], qPlant = $qPlant [-]"


#------------------------------------------------------------------------------

sed -e "s|RAS_MODEL|$RASmodel|g" \
    constant/turbulenceProperties.template \
  > constant/turbulenceProperties
sed -e "s|L_MAX|$Lmax|g" constant/fvOptions.template > constant/fvOptions
sed -e "s|Q_PLANT|$qPlant|g" 0/qPlant.template > 0/qPlant
rm -f 0/qPlant.template

runApplication renumberMesh -overwrite

runApplication $(getApplication)

# Scale up all the dimensions of the precursor computational domain
# to encapsulate the successor domain, so that mapFields can be used
runApplication transformPoints -scale '(10 10 1)' -translate '(0 0 20)'

#------------------------------------------------------------------------------
